﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using TestWebApplication.CommerceAccount;
using Microsoft.Commerce.Proxy.AccountService;
using TestWebApplication.CommerceTestDataProvider;

namespace TestWebApplication
{
    public class AccountHandler
    {
        public static Identity identity;

        public static AccountInfo getAccount(string puid, string liveid)
        {
            CommerceAccountServiceAdapter accountService = AdapterFactory.createAccountServiceAdapter();
            accountService.Initialize();

            Identity requester = CommerceAccountDataProvider.CreateIdentity(puid, liveid);
            CallerInfo callerInfo = CommerceAccountDataProvider.CreateCallerInfo(requester, null);

            GetAccountOutput account = accountService.GetAccount(null, callerInfo);
            identity = requester;

            return account.AccountOutputInfo[0];
        }
    }
}